package com.handmark.pulltorefresh.library.internal;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Matrix;
import android.graphics.drawable.Drawable;
import android.view.animation.Animation;
import android.view.animation.RotateAnimation;
import android.widget.ImageView;

import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode;
import com.handmark.pulltorefresh.library.PullToRefreshBase.Orientation;
import com.ss.android.article.browser.R;

public final class f extends LoadingLayout {
    private final Animation m;
    private final Matrix n;
    private final boolean q;
    private float o;
    private float p;

    public f(Context arg8, Mode arg9, Orientation arg10, TypedArray arg11) {
        super(arg8, arg9, arg10, arg11);
        this.q = arg11.getBoolean(com.ss.android.common.dd.F, true);
        this.c.setScaleType(ImageView.ScaleType.MATRIX);
        this.n = new Matrix();
        this.c.setImageMatrix(this.n);
        this.m = new RotateAnimation(0f, 720f, 1, 0.5f, 1, 0.5f);
        this.m.setInterpolator(com.handmark.pulltorefresh.library.internal.f.a);
        this.m.setDuration(1200);
        this.m.setRepeatCount(-1);
        this.m.setRepeatMode(1);
    }

    public final void a() {
    }

    public final void a(float arg5) {
        float v2 = 180f;
        float v0 = this.q ? 90f * arg5 : Math.max(0f, Math.min(v2, 360f * arg5 - v2));
        this.n.setRotate(v0, this.o, this.p);
        this.c.setImageMatrix(this.n);
    }

    public final void a(Drawable arg3) {
        float v1 = 2f;
        if (arg3 != null) {
            this.o = ((float) Math.round((((float) arg3.getIntrinsicWidth())) / v1));
            this.p = ((float) Math.round((((float) arg3.getIntrinsicHeight())) / v1));
        }
    }

    public final void b() {
        this.c.startAnimation(this.m);
    }

    public final void c() {
    }

    public final void d() {
        this.c.clearAnimation();
        this.n.reset();
        this.c.setImageMatrix(this.n);
    }

    public final int getDefaultDrawableResId() {
        return R.drawable.o1;
    }
}

